<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$_SESSION['uid']=$_SESSION['uid']?:0;
if($_RQ['op']=='main'){
	$return['params']=array('type'=>0);
	$return['list']=array();
	set_html('title','浏览记录');
	exi($return);
}
// js 获取数据
if($_RQ['op']=='getlist'){
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if(isset($_RQ['status']) && $_RQ['status'] !=100){
		$params['status']=intval($_RQ['status']);
		$return['status']=$return['params']['status']=$_RQ['status'];
	}else{
		$return['status']=100;
	}
	$type=intval($_RQ['type']);
	if($type){
		$params['tomid']=$_SESSION['uid'];
	}else{
		$params['mid']=$_SESSION['uid'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_ailiao_looklog',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	foreach($list as &$item){
		$item['createtime']=date('Y/m/d H:i:s',$item['createtime']);
		if($type){
			$item['member']=cfc('core')->member_show($item['mid']);
			$member=$this->get('member',array('mid'=>$item['mid'],'uniacid'=>$_SESSION['uniacid']),array('nickname','avatar','sex'));
		}else{
			$item['member']=cfc('core')->member_show($item['tomid']);
			$member=$this->get('member',array('mid'=>$item['tomid'],'uniacid'=>$_SESSION['uniacid']),array('nickname','avatar','sex'));
		}
		$item['member']['nickname']=$member['nickname']?:$item['member']['nickname'];
		$item['member']['avatar']=$member['avatar']?:$item['member']['avatar'];
		$item['member']['sex']=$member['sex']?:$item['member']['sex'];
	}
	$return['list']=$list;
	exi($return);
}
?>